<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>OpenShoe: udd.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">OpenShoe
   &#160;<span id="projectnumber">0.1</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">udd.h</div>  </div>
</div>
<div class="contents">
<a href="udd_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00039"></a>00039 <span class="preprocessor">#ifndef _UDD_H_</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span><span class="preprocessor">#define _UDD_H_</span>
<a name="l00041"></a>00041 <span class="preprocessor"></span>
<a name="l00042"></a>00042 <span class="preprocessor">#include &quot;<a class="code" href="usb__protocol_8h.html" title="USB protocol definitions.">usb_protocol.h</a>&quot;</span>
<a name="l00043"></a>00043 <span class="preprocessor">#include &quot;<a class="code" href="udc__desc_8h.html" title="Common API for USB Device Interface.">udc_desc.h</a>&quot;</span>
<a name="l00044"></a>00044 
<a name="l00045"></a>00045 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00046"></a>00046 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {
<a name="l00047"></a>00047 <span class="preprocessor">#endif</span>
<a name="l00048"></a>00048 <span class="preprocessor"></span>
<a name="l00060"></a>00060 
<a name="l00061"></a><a class="code" href="group__udd__group.html#ga6f25ea016c07bd48c3074f51d8ef8b01">00061</a> <span class="keyword">typedef</span> uint8_t <a class="code" href="group__udd__group.html#ga6f25ea016c07bd48c3074f51d8ef8b01" title="Endpoint identifier.">udd_ep_id_t</a>;
<a name="l00062"></a>00062 
<a name="l00065"></a><a class="code" href="group__udd__group.html#gac0f77f5a0e085af1242b48fd1054959a">00065</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
<a name="l00066"></a><a class="code" href="group__udd__group.html#ggac0f77f5a0e085af1242b48fd1054959aad52bb23180c67dc3d6a1d1dfedf74102">00066</a>         <a class="code" href="group__udd__group.html#ggac0f77f5a0e085af1242b48fd1054959aad52bb23180c67dc3d6a1d1dfedf74102">UDD_EP_TRANSFER_OK</a> = 0,
<a name="l00067"></a><a class="code" href="group__udd__group.html#ggac0f77f5a0e085af1242b48fd1054959aa010443246cb439e4f6f52b13c9d6e29c">00067</a>         <a class="code" href="group__udd__group.html#ggac0f77f5a0e085af1242b48fd1054959aa010443246cb439e4f6f52b13c9d6e29c">UDD_EP_TRANSFER_ABORT</a> = 1,
<a name="l00068"></a>00068 } <a class="code" href="group__udd__group.html#gac0f77f5a0e085af1242b48fd1054959a" title="Endpoint transfer status Returned in parameters of callback register via udd_ep_run routine...">udd_ep_status_t</a>;
<a name="l00069"></a>00069 
<a name="l00075"></a>00075 <a class="code" href="group__udi__cdc__group__desc.html#ga14096700b3ed8c5168615c5c5ee1c68d" title="Structure for USB Device Configuration Descriptor.">COMPILER_PACK_SET</a>(1);
<a name="l00076"></a><a class="code" href="structudd__setup__req__t.html">00076</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
<a name="l00077"></a><a class="code" href="structudd__setup__req__t.html#a40ec5987baf18ada7c852aa556102d51">00077</a>         uint8_t <a class="code" href="structudd__setup__req__t.html#a40ec5987baf18ada7c852aa556102d51">bmRequestType</a>;
<a name="l00078"></a><a class="code" href="structudd__setup__req__t.html#aa6d1f4b258b1b3ddb4eb446e17d0a258">00078</a>         uint8_t <a class="code" href="structudd__setup__req__t.html#aa6d1f4b258b1b3ddb4eb446e17d0a258">bRequest</a>;
<a name="l00079"></a><a class="code" href="structudd__setup__req__t.html#a2957ed930c944745d809f4dd28d46fc4">00079</a>         uint16_t <a class="code" href="structudd__setup__req__t.html#a2957ed930c944745d809f4dd28d46fc4">wValue</a>;
<a name="l00080"></a><a class="code" href="structudd__setup__req__t.html#aac97c21729d801db81853cd5bf45c953">00080</a>         uint16_t <a class="code" href="structudd__setup__req__t.html#aac97c21729d801db81853cd5bf45c953">wIndex</a>;
<a name="l00081"></a><a class="code" href="structudd__setup__req__t.html#a083a6f9b83f27aede156698631feb4f0">00081</a>         uint16_t <a class="code" href="structudd__setup__req__t.html#a083a6f9b83f27aede156698631feb4f0">wLength</a>;
<a name="l00082"></a>00082 } <a class="code" href="structudd__setup__req__t.html">udd_setup_req_t</a>;
<a name="l00083"></a>00083 <a class="code" href="group__udi__cdc__group__desc.html#gabe317a1520896eaf568afab27dc71540">COMPILER_PACK_RESET</a>();
<a name="l00084"></a>00084 
<a name="l00091"></a><a class="code" href="structudd__ctrl__request__t.html">00091</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
<a name="l00092"></a><a class="code" href="structudd__ctrl__request__t.html#a911ea25898e490e2095496e5fe24b1fe">00092</a>         <a class="code" href="structudd__setup__req__t.html">udd_setup_req_t</a> <a class="code" href="structudd__ctrl__request__t.html#a911ea25898e490e2095496e5fe24b1fe" title="Data received in USB SETUP packet.">req</a>;    
<a name="l00093"></a><a class="code" href="structudd__ctrl__request__t.html#a30ee45cc3e128d219f779f32635b6ca0">00093</a>         uint8_t *<a class="code" href="structudd__ctrl__request__t.html#a30ee45cc3e128d219f779f32635b6ca0" title="Point to buffer to send or fill with data following SETUP packet.">payload</a>;       
<a name="l00094"></a><a class="code" href="structudd__ctrl__request__t.html#a0ba5f434c1f252576dd707db0034917c">00094</a>         uint16_t <a class="code" href="structudd__ctrl__request__t.html#a0ba5f434c1f252576dd707db0034917c">payload_size</a>;  
<a name="l00095"></a>00095 
<a name="l00096"></a><a class="code" href="structudd__ctrl__request__t.html#a942a0402e868519a5ce6864941dd939e">00096</a>         void (*callback) (void);        
<a name="l00097"></a><a class="code" href="structudd__ctrl__request__t.html#afb9dab5e58e325dae17ea02345b097c4">00097</a>          bool(*over_under_run) (void);  
<a name="l00098"></a>00098 
<a name="l00099"></a>00099 } <a class="code" href="structudd__ctrl__request__t.html" title="Global variable to give and record information of the setup request management.">udd_ctrl_request_t</a>;
<a name="l00100"></a>00100 <span class="keyword">extern</span> <a class="code" href="structudd__ctrl__request__t.html" title="Global variable to give and record information of the setup request management.">udd_ctrl_request_t</a> <a class="code" href="group__udd__group.html#ga2a41c2b14c5be825bdce7fde8c365a30" title="Global variable to give and record information about setup request management.">udd_g_ctrlreq</a>;
<a name="l00101"></a>00101 
<a name="l00103"></a><a class="code" href="group__udd__group.html#gaffd9b7cf165cd149868373fa12595d12">00103</a> <span class="preprocessor">#define  Udd_setup_is_in()       \</span>
<a name="l00104"></a>00104 <span class="preprocessor">      (USB_REQ_DIR_IN == (udd_g_ctrlreq.req.bmRequestType &amp; USB_REQ_DIR_MASK))</span>
<a name="l00105"></a>00105 <span class="preprocessor"></span>
<a name="l00106"></a><a class="code" href="group__udd__group.html#gaf67b7c8de30fdc881b567385f2345926">00106</a> <span class="preprocessor">#define  Udd_setup_is_out()      \</span>
<a name="l00107"></a>00107 <span class="preprocessor">      (USB_REQ_DIR_OUT == (udd_g_ctrlreq.req.bmRequestType &amp; USB_REQ_DIR_MASK))</span>
<a name="l00108"></a>00108 <span class="preprocessor"></span>
<a name="l00109"></a><a class="code" href="group__udd__group.html#ga85dc2b7b6c270e8dd8323fa4779a7ca2">00109</a> <span class="preprocessor">#define  Udd_setup_type()        \</span>
<a name="l00110"></a>00110 <span class="preprocessor">      (udd_g_ctrlreq.req.bmRequestType &amp; USB_REQ_TYPE_MASK)</span>
<a name="l00111"></a>00111 <span class="preprocessor"></span>
<a name="l00112"></a><a class="code" href="group__udd__group.html#gac963bb7b8a965c2fec45a71c9faca6f5">00112</a> <span class="preprocessor">#define  Udd_setup_recipient()   \</span>
<a name="l00113"></a>00113 <span class="preprocessor">      (udd_g_ctrlreq.req.bmRequestType &amp; USB_REQ_RECIP_MASK)</span>
<a name="l00114"></a>00114 <span class="preprocessor"></span>
<a name="l00120"></a><a class="code" href="group__udd__group.html#ga7ab8d43f0761ecfb4d48770ac4ebb661">00120</a> <span class="keyword">typedef</span> void (*<a class="code" href="group__udd__group.html#ga7ab8d43f0761ecfb4d48770ac4ebb661" title="End of halt callback function type. Registered by routine udd_ep_wait_stall_clear() Callback called w...">udd_callback_halt_cleared_t</a>) (void);
<a name="l00121"></a>00121 
<a name="l00131"></a><a class="code" href="group__udd__group.html#gad866ed9444482edcf92a28dce807e3d3">00131</a> <span class="keyword">typedef</span> void (*<a class="code" href="group__udd__group.html#gad866ed9444482edcf92a28dce807e3d3" title="End of transfer callback function type. Registered by routine udd_ep_run() Callback called by USB int...">udd_callback_trans_t</a>) (<a class="code" href="group__udd__group.html#gac0f77f5a0e085af1242b48fd1054959a" title="Endpoint transfer status Returned in parameters of callback register via udd_ep_run routine...">udd_ep_status_t</a> status,
<a name="l00132"></a>00132                 iram_size_t nb_transfered);
<a name="l00133"></a>00133 
<a name="l00139"></a>00139 <span class="keywordtype">bool</span> <a class="code" href="group__udd__group.html#gaa4cac8c35ae056e26cf4ab5b426bbe09" title="Authorizes the VBUS event.">udd_include_vbus_monitoring</a>(<span class="keywordtype">void</span>);
<a name="l00140"></a>00140 
<a name="l00144"></a>00144 <span class="keywordtype">void</span> <a class="code" href="group__udd__group.html#ga9792d1899ae058e3984d6a622fe2ad42" title="Enables the USB Device mode.">udd_enable</a>(<span class="keywordtype">void</span>);
<a name="l00145"></a>00145 
<a name="l00149"></a>00149 <span class="keywordtype">void</span> <a class="code" href="group__udd__group.html#gab283432057b934e9d73ac9282d9b0f11" title="Disables the USB Device mode.">udd_disable</a>(<span class="keywordtype">void</span>);
<a name="l00150"></a>00150 
<a name="l00158"></a>00158 <span class="keywordtype">void</span> <a class="code" href="group__udd__group.html#ga7a7c0d9236c922c2af33c6702565a99f" title="Attach device to the bus when possible.">udd_attach</a>(<span class="keywordtype">void</span>);
<a name="l00159"></a>00159 
<a name="l00165"></a>00165 <span class="keywordtype">void</span> <a class="code" href="group__udd__group.html#ga03e59eaa264f1dbe5a52559311d0520e" title="Detaches the device from the bus.">udd_detach</a>(<span class="keywordtype">void</span>);
<a name="l00166"></a>00166 
<a name="l00173"></a>00173 <span class="keywordtype">bool</span> <a class="code" href="group__udd__group.html#ga85f403ddb78776b1ba014dafd3ffec2c" title="Test whether the USB Device Controller is running at high speed or not.">udd_is_high_speed</a>(<span class="keywordtype">void</span>);
<a name="l00174"></a>00174 
<a name="l00180"></a>00180 <span class="keywordtype">void</span> <a class="code" href="group__udd__group.html#ga05da762e0faf9d478e532de40afa71f6" title="Changes the USB address of device.">udd_set_address</a>(uint8_t address);
<a name="l00181"></a>00181 
<a name="l00187"></a>00187 uint8_t <a class="code" href="group__udd__group.html#gaebd36638d482f6df00a8aff006ef2246" title="Returns the USB address of device.">udd_getaddress</a>(<span class="keywordtype">void</span>);
<a name="l00188"></a>00188 
<a name="l00194"></a>00194 uint16_t <a class="code" href="group__udd__group.html#ga96dc248cc05e07ffe2cf21e4d7465320" title="Returns the current start of frame number.">udd_get_frame_number</a>(<span class="keywordtype">void</span>);
<a name="l00195"></a>00195 
<a name="l00201"></a>00201 uint16_t <a class="code" href="group__udd__group.html#ga96dc248cc05e07ffe2cf21e4d7465320" title="Returns the current start of frame number.">udd_get_frame_number</a>(<span class="keywordtype">void</span>);
<a name="l00202"></a>00202 
<a name="l00208"></a>00208 uint16_t <a class="code" href="group__udd__group.html#ga63047eec59b8e8798ca1d3366472d82b" title="Returns the current micro start of frame number.">udd_get_micro_frame_number</a>(<span class="keywordtype">void</span>);
<a name="l00209"></a>00209 
<a name="l00212"></a>00212 <span class="keywordtype">void</span> <a class="code" href="group__udd__group.html#ga14ae6068206556d6ae8766b1baa2f686" title="The USB driver sends a resume signal called Upstream Resume.">udd_send_wake_up</a>(<span class="keywordtype">void</span>);
<a name="l00213"></a>00213 
<a name="l00220"></a>00220 <span class="keywordtype">void</span> <a class="code" href="group__udd__group.html#ga017ef5ea7626be258c24d345218976f9" title="Load setup payload.">udd_set_setup_payload</a>( uint8_t *payload,   uint16_t payload_size );
<a name="l00221"></a>00221 
<a name="l00222"></a>00222 
<a name="l00231"></a>00231 
<a name="l00232"></a>00232 <span class="preprocessor">#if (0!=USB_DEVICE_MAX_EP)</span>
<a name="l00233"></a>00233 <span class="preprocessor"></span>
<a name="l00243"></a>00243 <span class="keywordtype">bool</span> udd_ep_alloc(udd_ep_id_t ep, uint8_t bmAttributes,
<a name="l00244"></a>00244                 uint16_t MaxEndpointSize);
<a name="l00245"></a>00245 
<a name="l00251"></a>00251 <span class="keywordtype">void</span> udd_ep_free(udd_ep_id_t ep);
<a name="l00252"></a>00252 
<a name="l00260"></a>00260 <span class="keywordtype">bool</span> udd_ep_is_halted(udd_ep_id_t ep);
<a name="l00261"></a>00261 
<a name="l00273"></a>00273 <span class="keywordtype">bool</span> udd_ep_set_halt(udd_ep_id_t ep);
<a name="l00274"></a>00274 
<a name="l00286"></a>00286 <span class="keywordtype">bool</span> udd_ep_clear_halt(udd_ep_id_t ep);
<a name="l00287"></a>00287 
<a name="l00298"></a>00298 <span class="keywordtype">bool</span> udd_ep_wait_stall_clear(udd_ep_id_t ep,
<a name="l00299"></a>00299                 <a class="code" href="group__udd__group.html#ga7ab8d43f0761ecfb4d48770ac4ebb661" title="End of halt callback function type. Registered by routine udd_ep_wait_stall_clear() Callback called w...">udd_callback_halt_cleared_t</a> callback);
<a name="l00300"></a>00300 
<a name="l00324"></a>00324 <span class="keywordtype">bool</span> udd_ep_run(udd_ep_id_t ep, <span class="keywordtype">bool</span> b_shortpacket,
<a name="l00325"></a>00325                 uint8_t * buf, iram_size_t buf_size,
<a name="l00326"></a>00326                 <a class="code" href="group__udd__group.html#gad866ed9444482edcf92a28dce807e3d3" title="End of transfer callback function type. Registered by routine udd_ep_run() Callback called by USB int...">udd_callback_trans_t</a> callback);
<a name="l00338"></a>00338 <span class="keywordtype">void</span> udd_ep_abort(udd_ep_id_t ep);
<a name="l00339"></a>00339 
<a name="l00340"></a>00340 <span class="preprocessor">#endif</span>
<a name="l00341"></a>00341 <span class="preprocessor"></span>
<a name="l00343"></a>00343 
<a name="l00344"></a>00344 
<a name="l00351"></a>00351 <span class="keywordtype">void</span> <a class="code" href="group__udd__group.html#ga43ba1e91e69f84c1481a659ff8eff143">udd_test_mode_j</a>(<span class="keywordtype">void</span>);
<a name="l00352"></a>00352 <span class="keywordtype">void</span> <a class="code" href="group__udd__group.html#ga2acd547bcd2b470ee4e1ce34087926a8">udd_test_mode_k</a>(<span class="keywordtype">void</span>);
<a name="l00353"></a>00353 <span class="keywordtype">void</span> <a class="code" href="group__udd__group.html#gabec7e8b6464e92ca9c8f32c59113bcbb">udd_test_mode_se0_nak</a>(<span class="keywordtype">void</span>);
<a name="l00354"></a>00354 <span class="keywordtype">void</span> <a class="code" href="group__udd__group.html#gab72f68f8d1a50f7e734595a2ff626380">udd_test_mode_packet</a>(<span class="keywordtype">void</span>);
<a name="l00356"></a>00356 
<a name="l00357"></a>00357 
<a name="l00364"></a>00364 
<a name="l00375"></a>00375 <span class="keyword">extern</span> <span class="keywordtype">bool</span> <a class="code" href="group__udc__group.html#ga58c2916d7984e0e5b2143cadf4af6080" title="Main routine to manage the USB SETUP request.">udc_process_setup</a>(<span class="keywordtype">void</span>);
<a name="l00376"></a>00376 
<a name="l00382"></a>00382 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="group__udc__group.html#ga11a32ff7928ba06d3b59e95e0a2b7a92" title="Reset the current configuration of the USB device, This routines can be called by UDD when a RESET on...">udc_reset</a>(<span class="keywordtype">void</span>);
<a name="l00383"></a>00383 
<a name="l00389"></a>00389 <span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="group__udc__group.html#ga4afae313045f44b5eb4c60957ab8ef4e" title="To signal that a SOF is occured.">udc_sof_notify</a>(<span class="keywordtype">void</span>);
<a name="l00390"></a>00390 
<a name="l00392"></a>00392 
<a name="l00394"></a>00394 
<a name="l00395"></a>00395 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00396"></a>00396 <span class="preprocessor"></span>}
<a name="l00397"></a>00397 <span class="preprocessor">#endif</span>
<a name="l00398"></a>00398 <span class="preprocessor"></span><span class="preprocessor">#endif // _UDD_H_</span>
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Mon Dec 19 2011 21:04:51 for OpenShoe by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
